package com.aspose.cells;

import java.util.ArrayList;
import java.util.HashMap;

class zajp {
   private zoz a = null;
   private WorksheetCollection b;
   private ArrayList c;
   private ArrayList d;
   private ArrayList e;
   private ArrayList f;
   private ArrayList g;
   private ArrayList h;
   private static final com.aspose.cells.b.c.a.za i = new com.aspose.cells.b.c.a.za(new String[]{"numFmtId", "fontId", "fillId", "borderId", "xfId", "applyNumberFormat", "applyFont", "applyFill", "applyBorder", "applyAlignment", "applyProtection", "quotePrefix", "alignment", "protection", "left", "start", "right", "end", "top", "bottom", "diagonal", "horizontal", "vertical"});

   zajp(zoz var1) {
      this.a = var1;
      this.b = this.a.a.getWorksheets();
   }

   void a(zcfw var1) throws Exception {
      this.y(var1);
      if (!var1.n()) {
         var1.d();

         while(var1.r() != 4) {
            var1.j();
            if (var1.r() != 1) {
               var1.a();
            } else if ("colors".equals(var1.p())) {
               this.n(var1);
            } else {
               var1.a();
            }
         }

      }
   }

   void b(zcfw var1) throws Exception {
      this.y(var1);
      if (!var1.n()) {
         var1.d();

         while(var1.r() != 4) {
            var1.j();
            if (var1.r() != 1) {
               var1.a();
            } else if ("numFmts".equals(var1.p())) {
               this.o(var1);
            } else if ("fonts".equals(var1.p())) {
               this.x(var1);
            } else if ("fills".equals(var1.p())) {
               this.u(var1);
            } else if ("borders".equals(var1.p())) {
               this.t(var1);
            } else if ("cellStyleXfs".equals(var1.p())) {
               this.s(var1);
            } else if ("cellXfs".equals(var1.p())) {
               this.r(var1);
            } else if ("cellStyles".equals(var1.p())) {
               this.p(var1);
            } else if ("dxfs".equals(var1.p())) {
               this.z(var1);
            } else if ("tableStyles".equals(var1.p())) {
               this.k(var1);
            } else if ("extLst".equals(var1.p())) {
               this.h(var1);
            } else {
               var1.a();
            }
         }

         this.c();
         this.a();
      }
   }

   private void h(zcfw var1) throws Exception {
      zcfq var2 = var1.a((zcft)null, false);
      this.a.a.b.l.a(5, var2.c());
      if (var2 instanceof zcfl) {
         zcfl var3 = null;
         zcfw var4 = null;
         zcfs var5 = zass.a((zcfl)var2, "dxf", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");

         for(int var6 = 0; var6 < var5.a(); ++var6) {
            if (var5.a(var6) instanceof zcfl) {
               var3 = (zcfl)var5.a(var6);
               var4 = zcfw.a(var3.b() + "</dxf>", false);
               znu var7 = a(this.b, var4);
               Style var8 = new Style(this.b);
               zajy.a(var8, var7);
               this.b.Y().b(var8);
            }
         }

         zcfs var9 = zass.a((zcfl)var2, "slicerStyles", "http://schemas.microsoft.com/offiice/spreadsheetml/2009/9/main");
         if (var9.a() > 0) {
            var3 = (zcfl)var9.a(0);
            var4 = zcfw.a(var3.b() + "</slicerStyles>", false);
            this.i(var4);
         }
      }

   }

   private void i(zcfw var1) throws Exception {
      if (var1.n()) {
         var1.a();
      } else {
         var1.d();

         while(true) {
            while(var1.r() != 4) {
               var1.j();
               if (var1.r() == 1 && "slicerStyle".equals(var1.p())) {
                  this.j(var1);
               } else {
                  var1.a();
               }
            }

            var1.h();
            return;
         }
      }
   }

   private void j(zcfw var1) throws Exception {
      String var2 = var1.a("name");
      zbnc var3 = new zbnc(var2, this.b.X());
      this.b.X().a(var3);
      if (var1.n()) {
         var1.a();
      } else {
         var1.d();

         while(true) {
            while(var1.r() != 4) {
               var1.j();
               if (var1.r() == 1 && "slicerStyleElements".equals(var1.p())) {
                  this.a(var1, var3.a());
               } else {
                  var1.a();
               }
            }

            var1.h();
            return;
         }
      }
   }

   private void a(zcfw var1, zbnf var2) throws Exception {
      if (var1.n()) {
         var1.a();
      } else {
         var1.d();

         while(true) {
            while(var1.r() != 4) {
               var1.j();
               if (var1.r() == 1 && "slicerStyleElement".equals(var1.p())) {
                  this.b(var1, var2);
               } else {
                  var1.a();
               }
            }

            var1.h();
            return;
         }
      }
   }

   private void b(zcfw var1, zbnf var2) throws Exception {
      String var3 = null;
      int var4 = -1;
      if (var1.m()) {
         while(true) {
            if (!var1.l()) {
               var1.k();
               break;
            }

            if ("type".equals(var1.p())) {
               var3 = var1.s();
            } else if ("dxfId".equals(var1.p())) {
               var4 = zase.C(var1.s());
            }
         }
      }

      zbne var5 = new zbne(var2, zbng.a(var3));
      if (var4 != -1) {
         var5.a = var4;
         var5.b = this.b.Y().get(var4);
      }

      var2.a(var5);
      var1.a();
   }

   private void k(zcfw var1) throws Exception {
      TableStyleCollection var2 = this.b.getTableStyles();
      var2.a(var1.a("defaultTableStyle"));
      var2.b(var1.a("defaultPivotStyle"));
      if (var1.n()) {
         var1.a();
      } else {
         var1.d();

         while(true) {
            while(var1.r() != 4) {
               var1.j();
               if (var1.r() == 1 && "tableStyle".equals(var1.p())) {
                  this.l(var1);
               } else {
                  var1.a();
               }
            }

            var1.h();
            return;
         }
      }
   }

   private void l(zcfw var1) throws Exception {
      TableStyle var2 = null;
      String var3 = null;
      String var4 = null;
      String var5 = null;
      if (var1.m()) {
         while(true) {
            if (!var1.l()) {
               var1.k();
               break;
            }

            if ("name".equals(var1.p())) {
               var3 = var1.s();
            } else if ("pivot".equals(var1.p())) {
               var4 = var1.s();
            } else if ("table".equals(var1.p())) {
               var5 = var1.s();
            }
         }
      }

      if (var3 != null) {
         int var6 = this.b.getTableStyles().c(var3);
         var2 = this.b.getTableStyles().get(var6);
         if (var4 != null) {
            var2.a("1".equals(var4));
         }

         if (var5 != null) {
            var2.b("1".equals(var5));
         }
      }

      if (var3 != null && !var1.n()) {
         var2.a(new TableStyleElementCollection(var2));
         var1.d();

         while(true) {
            while(var1.r() != 4) {
               var1.j();
               if (var1.r() == 1 && "tableStyleElement".equals(var1.p())) {
                  this.a(var1, var2);
               } else {
                  var1.a();
               }
            }

            var1.h();
            return;
         }
      } else {
         var1.a();
      }
   }

   private void a(zcfw var1, TableStyle var2) throws Exception {
      String var3 = null;
      String var4 = null;
      String var5 = null;
      if (var1.m()) {
         while(true) {
            if (!var1.l()) {
               var1.k();
               break;
            }

            if ("type".equals(var1.p())) {
               var3 = var1.s();
            } else if ("dxfId".equals(var1.p())) {
               var4 = var1.s();
            } else if ("size".equals(var1.p())) {
               var5 = var1.s();
            }
         }
      }

      if (var3 != null) {
         try {
            int var6 = zase.aC(var3);
            if (var2.b()) {
               if (var6 == 7) {
                  var6 = 28;
               } else if (var6 == 10) {
                  var6 = 29;
               }
            }

            TableStyleElement var7 = new TableStyleElement(var2.getTableStyleElements(), var6);
            if (var5 != null) {
               var7.setSize(zase.C(var5));
            }

            if (var4 != null) {
               var7.a = zase.C(var4);
            }

            var2.getTableStyleElements().a(var7);
         } catch (Exception var8) {
            ;
         }
      }

      var1.a();
   }

   private void a() {
      WorksheetCollection var1 = this.a.a.getWorksheets();
      var1.K();
      int var2 = ((var1.I() * 8 + var1.J()) / 8 + 1) * 8;
      double var3 = (double)(var2 - var1.J()) / (double)var1.I();

      for(int var5 = 0; var5 < var1.getCount(); ++var5) {
         Cells var6 = var1.get(var5).getCells();
         var6.a(var3);
      }

   }

   private HashMap b() {
      zbvx var1 = this.b.B();
      HashMap var2 = new HashMap();

      for(int var3 = 0; var3 < var1.getCount(); ++var3) {
         Style var4 = var1.a(var3);
         if (var4.c() != null) {
            var2.put(var4.c(), var3);
         }
      }

      return var2;
   }

   private void c() {
      this.d();
      zbvx var1 = this.b.B();
      HashMap var2 = this.b();
      int var3 = this.h == null ? 0 : this.h.size();
      int var4 = this.f == null ? 0 : this.f.size();

      int var5;
      zqp var7;
      for(var5 = 0; var5 < var3; ++var5) {
         znr var6 = (znr)this.h.get(var5);
         if (var6.b < var4) {
            var7 = (zqp)this.f.get(var6.b);
            var7.s = var6;
            var7.t = true;
         }
      }

      if (this.g != null) {
         for(var5 = 0; var5 < this.g.size(); ++var5) {
            zqp var13 = (zqp)this.g.get(var5);
            if (var13.i >= 0 && var13.i < var4) {
               var7 = (zqp)this.f.get(var13.i);
               var13.t = true;
            }
         }

         HashMap var12 = new HashMap(var4);

         Object var10;
         for(int var14 = 0; var14 < var4; ++var14) {
            var7 = (zqp)this.f.get(var14);
            if (var14 == 0 || var7.t) {
               Style var8 = new Style(this.b);
               this.a(var7, var8, false);
               var8.a(false);
               var8.a((int)-1);
               String var9 = null;
               if (var14 == 0) {
                  var9 = "Normal";
               } else if (var7.s != null) {
                  var9 = var7.s.a;
                  if (var9.equals("Default")) {
                     var9 = "Normal";
                  }
               }

               if (var9 != null) {
                  var8.a(var9);
                  if (var9.equals("Normal")) {
                     var1.a(0, var8);
                     var12.put(var14, 0);
                     if (!var8.k()) {
                        var8.getFont().c((Font)this.b.z().get(0));
                        var8.d(true);
                     }
                  } else {
                     var10 = var2.get(var9);
                     if (var10 != null) {
                        var12.put(var14, var10);
                        this.b.B().a((Integer)var10, var8);
                        this.b.r().a(var8, false);
                     } else {
                        var12.put(var14, this.b.B().e(var8));
                        this.b.r().a(var8, true);
                     }
                  }
               } else {
                  var12.put(var14, this.b.a(var8));
               }
            }
         }

         if (var3 == 0) {
            Style var15 = new Style(this.b);
            var15.a(true);
            var15.a((int)0);
            var1.a(15, var15);
         }

         this.a.d = new HashMap(this.g.size());
         this.a.e = new HashMap(this.g.size());
         byte var16 = -1;

         for(int var17 = 0; var17 < this.g.size(); ++var17) {
            zqp var18 = (zqp)this.g.get(var17);
            int var19 = 0;
            if (var18.i > 0) {
               var10 = var12.get(var18.i);
               if (var10 != null) {
                  var19 = (Integer)var10;
               }
            }

            Style var20 = new Style(this.b);
            var20.a(true);
            var20.a(var19);
            this.a(var18, var20, true);
            if (var17 == 0 && var4 > 0 && var3 > 0) {
               var16 = 0;
               var1.a(15, var20);
               var20.a((int)0);
               this.a.d.put(0, 15);
            } else {
               int var11 = var1.d(var20);
               this.a.d.put(var17, var11);
               if (var16 != -1 && var18.a((zqp)this.g.get(var16))) {
                  this.a.e.put(var17, true);
               }
            }
         }

      }
   }

   private Style a(zqp var1, Style var2, boolean var3) {
      if (var1.f != -1) {
         zoo var4 = (zoo)this.c.get(var1.f);
         var2.getFont().c((Font)this.b.z().get(var4.l()));
      }

      if (var1.e != -1 && (var1.l || var3)) {
         zxw var5 = this.b.i(var1.e);
         if (var5 != null) {
            var2.a(var1.e, var5.a(), var5.a);
         } else {
            var2.a(var1.e, "", false);
         }
      }

      if (var1.h > 0) {
         this.b(var1, var2);
      }

      if (var1.g != -1) {
         this.a(var1, var2);
      }

      var2.setVerticalAlignment(0);
      if (var1.c != null && (var1.p || var3)) {
         var1.c.a(var2, false);
      }

      if (var1.d != null) {
         var1.d.a(var2);
      }

      var2.e(var1.p || var1.c != null);
      var2.f(var1.o);
      var2.d(var1.m);
      var2.c(var1.l);
      var2.g(var1.n);
      var2.h(var1.q || var1.d != null);
      var2.i(var1.k);
      return var2;
   }

   private void a(zqp var1, Style var2) {
      if (var1.g != -1) {
         if (this.d.size() > var1.g) {
            zon var3 = (zon)this.d.get(var1.g);
            if (var3 != null) {
               if (var3.c != null) {
                  znq.a(var3.c, var2);
               } else if (var3.b != null) {
                  var3.b.b(var2);
               }
            }

         }
      }
   }

   private void b(zqp var1, Style var2) {
      if (var1.h != -1) {
         if (this.e != null && this.e.size() != 0 && this.e.size() > var1.h) {
            zno var3 = (zno)this.e.get(var1.h);
            var3.a(var2);
         }
      }
   }

   private void d() {
      if (this.c != null) {
         for(int var1 = 0; var1 < this.c.size(); ++var1) {
            zoo var2 = (zoo)this.c.get(var1);
            a(this.b, var2, var1 == 0);
            this.a.d().put(var1, var2.l());
         }

      }
   }

   private static void a(WorksheetCollection var0, zoo var1, boolean var2) {
      if (var1.a) {
         var1.d(0);
      } else {
         Font var3 = new Font(var0, (Object)null, false);
         var1.a(var3);
         if (var2) {
            var3.d(0);
            var1.d(0);
            var0.z().set(0, var3);
         } else {
            if (var0.z().size() > 3) {
               var3.d(var0.z().size() + 1);
            } else {
               var3.d(var0.z().size());
            }

            var1.d(var0.z().size());
            com.aspose.cells.b.a.a.ze.a(var0.z(), (Object)var3);
         }

      }
   }

   private void m(zcfw var1) throws Exception {
      if (var1.n()) {
         throw new CellsException(6, "Invalid indexedColors element");
      } else {
         var1.d();
         int var2 = 0;

         while(true) {
            while(var1.r() != 4) {
               var1.j();
               if (var1.r() == 1 && "rgbColor".equals(var1.p())) {
                  if (var2 < 8) {
                     ++var2;
                     var1.a();
                  } else {
                     String var3 = var1.a("rgb", "");
                     if (var3 != null) {
                        int var4 = com.aspose.cells.b.a.zo.a(var3, 515, com.aspose.cells.b.a.c.za.b());
                        this.a.a.changePalette(Color.fromArgb(var4), var2 - 8);
                     }

                     ++var2;
                     var1.a();
                  }
               } else {
                  var1.a();
               }
            }

            var1.h();
            return;
         }
      }
   }

   private void n(zcfw var1) throws Exception {
      if (var1.n()) {
         var1.a();
      } else {
         var1.d();

         while(true) {
            while(var1.r() != 4) {
               var1.j();
               if (var1.r() == 1 && "indexedColors".equals(var1.p()) && !var1.n()) {
                  this.m(var1);
               } else {
                  var1.a();
               }
            }

            var1.h();
            return;
         }
      }
   }

   private void o(zcfw var1) throws Exception {
      if (var1.n()) {
         var1.a();
      } else {
         int var2 = zase.a(var1);
         var1.d();

         while(true) {
            while(var1.r() != 4) {
               var1.j();
               if (var1.r() == 1 && "numFmt".equals(var1.p())) {
                  zxw var3 = c(var1);
                  if (var3.e() != null) {
                     com.aspose.cells.b.a.a.ze.a(this.b.A(), (Object)var3);
                  }

                  if (var3.b() > (this.b.w() & '\uffff')) {
                     this.b.e(var3.b());
                  }
               } else {
                  var1.a();
               }
            }

            var1.h();
            return;
         }
      }
   }

   static zxw c(zcfw var0) throws Exception {
      zxw var1 = new zxw();
      if (var0.m()) {
         int var2 = 0;
         String var3 = null;

         while(var0.l()) {
            if ("numFmtId".equals(var0.p())) {
               var2 = com.aspose.cells.b.a.zo.a(var0.s(), com.aspose.cells.b.a.c.za.b());
            } else if ("formatCode".equals(var0.p())) {
               var3 = zase.b(var0.s());
            }
         }

         if (var3 != null) {
            var1.a(var3, var2);
            var1.a = zgb.a(var3);
         }

         var0.k();
      }

      var0.a();
      return var1;
   }

   private void p(zcfw var1) throws Exception {
      if (var1.n()) {
         var1.a();
      } else {
         int var2 = zase.a(var1);
         this.h = new ArrayList(var2);
         var1.d();

         while(true) {
            while(var1.r() != 4) {
               var1.j();
               if (var1.r() == 1 && "cellStyle".equals(var1.p())) {
                  znr var3 = this.q(var1);
                  com.aspose.cells.b.a.a.ze.a(this.h, (Object)var3);
               } else {
                  var1.a();
               }
            }

            var1.h();
            return;
         }
      }
   }

   private znr q(zcfw var1) throws Exception {
      znr var2 = new znr();
      if (var1.m()) {
         while(true) {
            if (!var1.l()) {
               var1.k();
               break;
            }

            if ("name".equals(var1.p())) {
               var2.a = var1.s();
            } else if ("xfId".equals(var1.p())) {
               var2.b = zase.C(var1.s());
            } else if ("builtinId".equals(var1.p())) {
               var2.c = zase.C(var1.s());
            }
         }
      }

      var1.a();
      if (var2.b >= 0 && var2.b < this.f.size()) {
         return var2;
      } else {
         throw new CellsException(6, "Invalid XfId");
      }
   }

   private void r(zcfw var1) throws Exception {
      if (var1.n()) {
         var1.a();
      } else {
         int var2 = zase.a(var1);
         this.g = new ArrayList(var2);
         var1.d();

         while(true) {
            while(var1.r() != 4) {
               var1.j();
               if (var1.r() == 1 && "xf".equals(var1.p())) {
                  zqp var3 = this.b(var1, false);
                  var3.b = false;
                  com.aspose.cells.b.a.a.ze.a(this.g, (Object)var3);
               } else {
                  var1.a();
               }
            }

            var1.h();
            return;
         }
      }
   }

   private void s(zcfw var1) throws Exception {
      if (var1.n()) {
         var1.a();
      } else {
         int var2 = zase.a(var1);
         this.f = new ArrayList(var2);
         var1.d();

         while(true) {
            while(var1.r() != 4) {
               var1.j();
               if (var1.r() == 1 && "xf".equals(var1.p())) {
                  zqp var3 = this.b(var1, true);
                  var3.b = false;
                  com.aspose.cells.b.a.a.ze.a(this.f, (Object)var3);
               } else {
                  var1.a();
               }
            }

            var1.h();
            return;
         }
      }
   }

   private zqp b(zcfw var1, boolean var2) throws Exception {
      zqp var3 = new zqp();
      if (var2) {
         var3.l = true;
         var3.m = true;
         var3.n = true;
         var3.o = true;
         var3.p = true;
         var3.q = true;
      }

      if (var1.m()) {
         while(var1.l()) {
            switch(i.a(var1.p())) {
            case 0:
               var3.e = zase.C(var1.s());
               break;
            case 1:
               var3.f = zase.C(var1.s());
               break;
            case 2:
               var3.g = zase.C(var1.s());
               break;
            case 3:
               var3.h = zase.C(var1.s());
               break;
            case 4:
               var3.i = zase.C(var1.s());
               break;
            case 5:
               var3.l = zase.ax(var1.s());
               break;
            case 6:
               var3.m = zase.ax(var1.s());
               break;
            case 7:
               var3.n = zase.ax(var1.s());
               break;
            case 8:
               var3.o = zase.ax(var1.s());
               break;
            case 9:
               var3.p = zase.ax(var1.s());
               break;
            case 10:
               var3.q = zase.ax(var1.s());
               break;
            case 11:
               var3.k = zase.ax(var1.s());
            }
         }

         var1.k();
      }

      if (var1.n()) {
         var1.a();
         return var3;
      } else {
         var1.d();

         while(zass.a(var1)) {
            switch(i.a(var1.p())) {
            case 12:
               var3.c = d(var1);
               break;
            case 13:
               var3.d = e(var1);
               break;
            default:
               var1.a();
            }
         }

         return var3;
      }
   }

   static znl d(zcfw var0) throws Exception {
      if (!var0.m()) {
         var0.a();
         return null;
      } else {
         znl var1 = new znl();

         do {
            label54:
            do {
               while(true) {
                  while(true) {
                     while(var0.l()) {
                        if (!"horizontal".equals(var0.p())) {
                           if (!"vertical".equals(var0.p())) {
                              if ("textRotation".equals(var0.p())) {
                                 var1.a(zase.C(var0.s()));
                                 continue label54;
                              }

                              if ("wrapText".equals(var0.p())) {
                                 var1.a(zase.ax(var0.s()));
                              } else if ("indent".equals(var0.p())) {
                                 var1.b(zase.C(var0.s()));
                              } else if ("shrinkToFit".equals(var0.p())) {
                                 var1.b(zase.ax(var0.s()));
                              } else if ("readingOrder".equals(var0.p())) {
                                 var1.c(zase.y(var0.s()));
                              } else if ("justifyLastLine".equals(var0.p())) {
                                 var1.b = zase.ax(var0.s());
                              }
                           } else {
                              var1.c = var0.s();
                           }
                        } else {
                           var1.a = var0.s();
                        }
                     }

                     var0.k();
                     var0.a();
                     return var1;
                  }
               }
            } while(var1.a() == 255);
         } while(var1.a() >= 0 && var1.a() <= 180);

         throw new CellsException(6, "style textRotation must between 0 and 180");
      }
   }

   static zqd e(zcfw var0) throws Exception {
      if (!var0.m()) {
         var0.a();
         return null;
      } else {
         zqd var1 = new zqd();

         while(var0.l()) {
            if ("hidden".equals(var0.p())) {
               var1.b = zase.ax(var0.s());
            } else if ("locked".equals(var0.p())) {
               var1.a = zase.ax(var0.s());
            }
         }

         var0.k();
         var0.a();
         return var1;
      }
   }

   private void t(zcfw var1) throws Exception {
      if (var1.n()) {
         var1.a();
      } else {
         int var2 = zase.a(var1);
         this.e = new ArrayList(var2);
         var1.d();

         while(true) {
            while(var1.r() != 4) {
               var1.j();
               if (var1.r() == 1 && "border".equals(var1.p())) {
                  zno var3 = null;
                  if (!var1.n()) {
                     var3 = a(var1, false);
                  } else {
                     var3 = new zno();
                     var1.a();
                  }

                  com.aspose.cells.b.a.a.ze.a(this.e, (Object)var3);
               } else {
                  var1.a();
               }
            }

            var1.h();
            return;
         }
      }
   }

   static zno a(zcfw var0, boolean var1) throws Exception {
      zno var2 = new zno();
      String var3 = var0.a("diagonalDown");
      String var4 = var0.a("diagonalUp");
      if (var3 != null) {
         var2.i = zase.ax(var3);
      }

      if (var4 != null) {
         var2.j = zase.ax(var4);
      }

      if (var0.n()) {
         var0.a();
         return null;
      } else {
         var0.d();

         while(var0.r() != 4) {
            var0.j();
            if (var0.r() == 1) {
               a(var0, var2, var1);
            } else {
               var0.a();
            }
         }

         var0.h();
         return var2;
      }
   }

   private static void a(zcfw var0, zno var1, boolean var2) throws Exception {
      znp var3 = new znp();
      switch(i.a(var0.p())) {
      case 14:
      case 15:
         var1.c = var3;
         break;
      case 16:
      case 17:
         var1.e = var3;
         break;
      case 18:
         var1.b = var3;
         break;
      case 19:
         var1.d = var3;
         break;
      case 20:
         var1.f = var3;
         break;
      case 21:
         var1.g = var3;
         break;
      case 22:
         var1.h = var3;
         break;
      default:
         var0.a();
         return;
      }

      String var4 = var0.a("style", "");
      if (var4 != null) {
         var3.a = var4;
      } else if (var2) {
         var3.a = "none";
      }

      if (var0.n()) {
         var0.a();
      } else {
         var0.d();

         while(true) {
            while(var0.r() != 4) {
               var0.j();
               if (var0.r() == 1 && "color".equals(var0.p())) {
                  var3.b = g(var0);
               } else {
                  var0.a();
               }
            }

            var0.h();
            return;
         }
      }
   }

   private void u(zcfw var1) throws Exception {
      if (var1.n()) {
         var1.a();
      } else {
         int var2 = zase.a(var1);
         this.d = new ArrayList(var2);
         var1.d();

         while(true) {
            while(var1.r() != 4) {
               var1.j();
               if (var1.r() == 1 && "fill".equals(var1.p()) && !var1.n()) {
                  zon var3 = f(var1);
                  com.aspose.cells.b.a.a.ze.a(this.d, (Object)var3);
               } else {
                  var1.a();
               }
            }

            var1.h();
            return;
         }
      }
   }

   static zon f(zcfw var0) throws Exception {
      zon var1 = new zon();
      var0.d();

      while(var0.r() != 4) {
         var0.j();
         if (var0.r() == 1) {
            if ("patternFill".equals(var0.p())) {
               var1.b = w(var0);
            } else if ("gradientFill".equals(var0.p())) {
               var1.c = v(var0);
            } else {
               var0.a();
            }
         } else {
            var0.a();
         }
      }

      var0.h();
      if (var1.b == null && var1.c == null) {
         return null;
      } else {
         return var1;
      }
   }

   private static znq v(zcfw var0) throws Exception {
      znq var1 = new znq();
      if (var0.m()) {
         while(true) {
            if (!var0.l()) {
               var0.k();
               break;
            }

            if ("bottom".equals(var0.p())) {
               var1.d = zase.B(var0.s());
            } else if ("degree".equals(var0.p())) {
               var1.f = zase.C(var0.s());
            } else if ("left".equals(var0.p())) {
               var1.a = zase.B(var0.s());
            } else if ("right".equals(var0.p())) {
               var1.b = zase.B(var0.s());
            } else if ("top".equals(var0.p())) {
               var1.c = zase.B(var0.s());
            } else if ("type".equals(var0.p())) {
               var1.e = var0.s();
            }
         }
      }

      if (var0.n()) {
         var0.a();
         return var1;
      } else {
         ArrayList var2 = new ArrayList(4);
         ArrayList var3 = new ArrayList(4);
         var0.d();

         while(true) {
            while(var0.r() != 4) {
               var0.j();
               if (var0.r() == 1 && "stop".equals(var0.p()) && !var0.n()) {
                  double var4 = 0.0D;
                  String var6 = var0.a("position");
                  if (var6 != null) {
                     var4 = zase.B(var6);
                  }

                  if (var0.n()) {
                     var0.a();
                  }

                  var0.d();

                  while(true) {
                     while(var0.r() != 4) {
                        var0.j();
                        if (var0.r() == 1 && "color".equals(var0.p())) {
                           zakp var7 = g(var0);
                           if (var7.a()) {
                              var7.a(2, Color.getWhite().toArgb());
                           }

                           com.aspose.cells.b.a.a.ze.a(var2, (Object)var4);
                           com.aspose.cells.b.a.a.ze.a(var3, (Object)var7);
                        } else {
                           var0.a();
                        }
                     }

                     var0.h();
                     break;
                  }
               } else {
                  var0.a();
               }
            }

            var0.h();
            int var8 = var2.size();
            var1.g = new double[var8];
            var1.h = new zakp[var8];

            for(int var5 = 0; var5 < var8; ++var5) {
               var1.g[var5] = (Double)var2.get(var5);
               var1.h[var5] = (zakp)var3.get(var5);
            }

            return var1;
         }
      }
   }

   private static zqb w(zcfw var0) throws Exception {
      zqb var1 = new zqb();
      String var2 = var0.a("patternType", "");
      if (var2 != null) {
         zase.i(var2);
         var1.a = var2;
      }

      if (var0.n()) {
         var0.a();
         return var1;
      } else {
         var0.d();

         while(var0.r() != 4) {
            var0.j();
            if (var0.r() != 1) {
               var0.a();
            } else if ("fgColor".equals(var0.p())) {
               var1.b = g(var0);
            } else if ("bgColor".equals(var0.p())) {
               var1.c = g(var0);
            } else {
               var0.a();
            }
         }

         var0.h();
         return var1;
      }
   }

   private void x(zcfw var1) throws Exception {
      if (var1.n()) {
         var1.a();
      } else {
         int var2 = zase.a(var1);
         this.c = new ArrayList(var2);
         this.a.i = this.c;
         var1.d();

         while(true) {
            while(var1.r() != 4) {
               var1.j();
               if (var1.r() == 1 && "font".equals(var1.p())) {
                  zoo var3;
                  if (var1.n()) {
                     var3 = new zoo();
                     var3.a = true;
                     com.aspose.cells.b.a.a.ze.a(this.c, (Object)var3);
                     var1.a();
                  } else {
                     var3 = a(var1, this.a.a.getWorksheets(), "name");
                     com.aspose.cells.b.a.a.ze.a(this.c, (Object)var3);
                  }
               } else {
                  var1.a();
               }
            }

            var1.h();
            return;
         }
      }
   }

   static zoo a(zcfw var0, WorksheetCollection var1, String var2) throws Exception {
      if (var0.n()) {
         var0.a();
         return null;
      } else {
         var0.d();
         zoo var3 = new zoo();

         while(var0.r() != 4) {
            var0.j();
            if (var0.r() != 1) {
               var0.a();
            } else {
               String var4;
               if ("sz".equals(var0.p())) {
                  var4 = var0.a("val", "");
                  if (var4 != null) {
                     var3.a(zase.B(var4));
                  }

                  var0.a();
               } else if (com.aspose.cells.b.a.zv.b(var0.p(), var2)) {
                  var4 = var0.a("val", "");
                  if (var4 != null) {
                     var3.d(zase.b(var4));
                  }

                  var0.a();
               } else if ("family".equals(var0.p())) {
                  var4 = var0.a("val", "");
                  if (var4 != null) {
                     var3.c(zase.C(var4));
                  }

                  var0.a();
               } else if ("b".equals(var0.p())) {
                  var4 = var0.a("val", "");
                  var3.b(zase.b(var4, true));
                  var0.a();
               } else if ("i".equals(var0.p())) {
                  var4 = var0.a("val", "");
                  var3.a(zase.b(var4, true));
                  var0.a();
               } else if ("u".equals(var0.p())) {
                  var4 = var0.a("val", "");
                  if (var4 != null) {
                     var3.a(zase.A(var4));
                  } else {
                     var3.a(1);
                  }

                  var0.a();
               } else if ("color".equals(var0.p())) {
                  var3.a(g(var0));
               } else if ("charset".equals(var0.p())) {
                  var4 = var0.a("val", "");
                  if (var4 != null) {
                     var3.e(com.aspose.cells.b.a.ze.d(var4));
                  }

                  var0.a();
               } else if ("strike".equals(var0.p())) {
                  var4 = var0.a("val", "");
                  var3.c(zase.b(var4, true));
                  var0.a();
               } else if ("vertAlign".equals(var0.p())) {
                  var4 = var0.a("val", "");
                  if ("subscript".equals(var4)) {
                     var3.e(true);
                  } else if ("superscript".equals(var4)) {
                     var3.f(true);
                  }

                  var0.a();
               } else if ("scheme".equals(var0.p())) {
                  var3.a(var0.a("val", ""));
                  var0.a();
                  Workbook var7 = var1.n();
                  if (var7.getSettings().getRegion() != 0) {
                     boolean var5 = true;
                     if ("minor".equals(var3.a().toLowerCase())) {
                        var5 = false;
                     }

                     String var6 = var7.c.f.a(var7.getSettings().getRegion(), var5);
                     if (var6 != null) {
                        var3.d(var6);
                     }
                  }
               } else {
                  var0.a();
               }
            }
         }

         var0.h();
         return var3;
      }
   }

   static zakp g(zcfw var0) throws Exception {
      zakp var1 = new zakp(false);
      String var2 = var0.a("indexed");
      String var3 = var0.a("rgb");
      String var4 = var0.a("theme");
      String var5 = var0.a("tint");
      var0.a();
      int var6;
      if (var2 != null) {
         var6 = zase.C(var2);
         if (var6 >= 0 && var6 < 64) {
            var1.a(3, var6);
         } else if (var6 != 65 && var6 != 64) {
            var1.a(true);
         } else {
            var1.a(true);
         }
      } else if (var3 != null) {
         Color var7 = zase.t(var3);
         var1.a(2, var7.toArgb());
      } else if (var4 != null) {
         var6 = zase.C(var4);
         var1.a(4, var6);
      } else {
         var1.a(true);
      }

      if (var5 != null) {
         var1.a(zase.B(var5));
      }

      return var1;
   }

   private void y(zcfw var1) throws Exception {
      var1.a(0);
      var1.j();
      if (var1.r() == 1 && "styleSheet".equals(var1.p())) {
         if (var1.m()) {
            ArrayList var2 = new ArrayList();

            while(var1.l()) {
               if (!"xmlns".equals(var1.o()) && !"xmlns:r".equals(var1.o())) {
                  com.aspose.cells.b.a.a.ze.a(var2, (Object)(new znm(var1.o(), var1.s())));
               }
            }

            var1.k();
            if (var2.size() > 0) {
               this.a.a.b.l.a(4, var2);
            }
         }

      } else {
         throw new CellsException(6, "styleSheet root element eror");
      }
   }

   private void z(zcfw var1) throws Exception {
      if (var1.n()) {
         var1.a();
      } else {
         int var2 = zase.a(var1);
         int var3 = 0;
         var1.d();

         while(true) {
            while(var1.r() != 4) {
               var1.j();
               if (var1.r() == 1 && "dxf".equals(var1.p()) && !var1.n()) {
                  ++var3;
                  znu var4 = a(this.b, var1);
                  Style var5 = new Style(this.b);
                  zajy.a(var5, var4);
                  this.b.getDxfs().b(var5);
               } else {
                  var1.a();
               }
            }

            var1.h();
            return;
         }
      }
   }

   static znu a(WorksheetCollection var0, zcfw var1) throws Exception {
      znu var2 = new znu();
      if (var1.n()) {
         var1.a();
         return var2;
      } else {
         var1.d();

         while(var1.r() != 4) {
            var1.j();
            if (var1.r() != 1) {
               var1.a();
            } else if ("font".equals(var1.p())) {
               var2.a = a(var1, var0, "name");
            } else if ("fill".equals(var1.p())) {
               var2.b = f(var1);
            } else if ("border".equals(var1.p())) {
               var2.c = a(var1, true);
            } else if ("numFmt".equals(var1.p())) {
               var2.d = c(var1);
            } else if ("alignment".equals(var1.p())) {
               var2.e = d(var1);
            } else if ("protection".equals(var1.p())) {
               var2.f = e(var1);
            } else {
               var1.a();
            }
         }

         var1.h();
         return var2;
      }
   }
}
